package main

import (
	"fmt"
	"gosudoku/solver"
	"log"
	"os"
	"strings"
)

// read file from argv
func main() {
	// read file from argv
	if os.Args[1] == "" {
		fmt.Println("Usage: sudio <filename>")
		os.Exit(1)
	}
	filename := os.Args[1]
	// read file
	data, err := os.ReadFile(filename)
	if err != nil {
		log.Fatal(err)
	}
	filename = fmt.Sprintf("%s%s", strings.TrimSuffix(filename, ".json"), ".jpg")
	layout := solver.ReadDrawJson(data)

	layout.DrawGrid(filename)
}
